<template>
    <div>
        <h1>会员等级</h1>
        <table class="table">
            <tr>
                <td>权益名称:</td>
                <td>
                    <input type="text" v-model="data.aname">
                </td>
            </tr>
            <tr>
                <td>权益说明:</td>
                <td>
                    <input type="text" v-model="data.sum">
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="button" value="添加" @click="andadd" class="btn btn-success">
                </td>
            </tr>
        </table>
    </div>
</template>
<script setup lang="ts">
import { ref,onMounted } from 'vue';
import axios from 'axios';
import { useRouter,useRoute } from 'vue-router';
import { useStore } from '@/stores/info';
const userst=useStore();

const router=useRouter();
const route=useRoute();



const data=ref({
    
 "aid": 0,
  "aname": "",
  "sum": "",
  "state": true

})

const andadd=()=>{
    axios.post("https://localhost:7237/api/Deng/Addand",data.value).then(res=>{
        if(res.data>0){
            alert('添加成功');
            router.push({path:"/Showand"})
        }
        else{
            alert('添加失败');
        }
    })
}
</script>

<style scoped>

</style>